import java.util.Arrays;

/**
 * @ClassName LCMS17_04
 * @Author ykx
 * @Date 2024/7/10 1:04
 * @Version 1.0
 */
public class LCMS17_04 {
    public static void main(String[] args) {
        LCMS17_04 lcms17_04 = new LCMS17_04();
        System.out.println(lcms17_04.missingNumber(new int[]{3, 0, 1}));
    }

    public int missingNumber(int[] nums) {
        int sum = 0;
        for (int i = 0; i <= nums.length; i++) {
            sum += i;
        }

        return sum - Arrays.stream(nums).sum();

    }
}
